﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace iTelluro.Explorer.Infrastructure.Data.Seedwork
{
    public interface IIntricateDataObj:IDisposable
    {
        /// <summary>
        /// 执行SQL语句返回DataReader
        /// </summary>
        /// <param name="sql">SQL语句</param>
        /// <param name="parameters">参数</param>
        /// <returns></returns>
        System.Data.IDataReader ExecuteReader(string sql, params object[] parameters);
        /// <summary>
        /// 执行SQL语句返回DataSet
        /// </summary>
        /// <param name="sql">SQL语句</param>
        /// <param name="parameters">参数</param>
        /// <returns></returns>
        DataSet ExecuteDataSet(string sql, params object[] parameters);
        /// <summary>
        /// 执行SQL语句数组返回DataSet
        /// </summary>
        /// <param name="sql">SQL语句数组</param>
        /// <param name="parameters">参数</param>
        /// <returns></returns>
        DataSet ExecuteDataSet(string[] sql, params object[] parameters);
        /// <summary>
        /// 执行SQL语句返回第一行第一列
        /// </summary>
        /// <param name="sql"></param>
        /// <param name="parameters"></param>
        /// <returns></returns>
        object ExecuteScalar(string sql, params object[] parameters);
        /// <summary>
        /// 关闭数据库连接
        /// </summary>
        void CloseConnection();
        /// <summary>
        /// 打开数据库连接
        /// </summary>
        void OpenConnection();
        /// <summary>
        /// 获取当前表的所有列名
        /// </summary>
        /// <param name="tableName">表名</param>
        /// <returns></returns>
        List<string> GetColumns(string tableName);
        int ExecuteNonQuery(string sql, params object[] parameters);
        string SubString(string s, int index, int length);
        string And();
        /// <summary>
        /// 更改连接
        /// </summary>
        /// <param name="subSysType"></param>
        void SetDBConfiguration(string subSysType);
        /// <summary>
        /// 将整个表新增至数据库
        /// </summary>
        /// <param name="table"></param>
        void BulkInsert(DataTable table);
    }
}
